{% extends 'common/base.html' %}
{% load staticfiles %}
{% block section %}
    <a class="btn btn-default btn-lg btn-info" href="{% static 'import_users.xls' %}" download>下载模板</a>
    <form action="/import_users/" method="post" enctype="multipart/form-data" style="margin-top:20px;">
        {% csrf_token %}
        <div class="form-group">
            <label for="">请选择要导入的用户表:
                <p></p>
                <input type="file" name="excel" class="file-upload">
            </label>
        </div>
        {% if message %}
            <p style="color: red;font-weight: bold;">{{ message }}</p>
        {% endif %}
        <div class="btn-group">
            <input type="submit" class="btn btn-default btn-success" value="确认导入">
        </div>

    </form>
    <hr>
    <div class="import-result">
        <dl>
            <dt>表格中用户总数:</dt>
            <dd>{{ totalNum }}</dd>
            <dt>系统或表格中重复的用户:</dt>
            {% for foo in existUser %}
            <dd>{{ foo }}</dd>
            {% endfor %}
            <dt>导入成功的用户如下:</dt>
            {% for foo in importUser %}
            <dd>{{ foo.username }}-{{ foo.get_full_name }}</dd>
            {% endfor %}
        </dl>
    </div>

{% endblock %}